﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Composite.Regions;

namespace APJunktion.ATP.UDPClient.Module.Main
{
    [Module(ModuleName = "Main")]
    public class Main : IModule
    {
        #region Properties
        
        private readonly IRegionManager regionManager;
        private Views.Main _main = new APJunktion.ATP.UDPClient.Module.Main.Views.Main();
        private Views.Scoreboard _scoreboard = new APJunktion.ATP.UDPClient.Module.Main.Views.Scoreboard();

        #endregion

        #region Init

        public Main(IRegionManager regionManager)
        {
            this.regionManager = regionManager;
        }

        #endregion

        #region IModule Members

        public void Initialize()
        {
            IRegion mainRegion = this.regionManager.Regions["MainRegion"];                        
            mainRegion.Add(_main);
            mainRegion.Activate(_main);

            IRegion Scoreboard = this.regionManager.Regions["ScoreboardRegion"];            
            Scoreboard.Add(_scoreboard);
            Scoreboard.Activate(_scoreboard);            
        }

        public void UpdateScore()
        {
            
        }

        public void UpdateSpeed(string speed)
        {
            _scoreboard.UpdateSpeed(speed);
        }

        #endregion
    }
}
